package com.ihd.ihardware.view.tzc.health.view;

import android.arch.lifecycle.AndroidViewModel;
import android.os.Bundle;
import android.support.v4.app.FragmentPagerAdapter;
import android.view.View;

import com.ihd.ihardware.R;
import com.ihd.ihardware.databinding.ActivityTargetRecordBinding;
import com.trello.rxlifecycle2.components.support.RxFragment;

import java.util.ArrayList;
import java.util.List;

import cn.wowjoy.commonlibrary.base.BaseActivity;

public class HandRecordActivity extends BaseActivity<ActivityTargetRecordBinding, AndroidViewModel> {
    private FragmentPagerAdapter mFragmentPagerAdapter;
    private List<RxFragment> mFragment;

    @Override
    protected void init(Bundle savedInstanceState) {
        mImmersionBar.statusBarDarkFont(true).init();
        mFragment = new ArrayList<>();
        mFragment.add(RecordWeightFragment.newInstance("", ""));
        mFragment.add(RecordSizeFragment.newInstance("", ""));
        mFragmentPagerAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
            @Override
            public RxFragment getItem(int position) {
                return mFragment.get(position);
            }

            @Override
            public int getCount() {
                return mFragment.size();
            }
        };

        binding.vp.setAdapter(mFragmentPagerAdapter);
        binding.vp.setCurrentItem(0);

        binding.back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

//        binding.tzLL.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                binding.tzTV.setTextColor(getResources().getColor(R.color.C_32353B));
//                binding.tzV.setVisibility(View.VISIBLE);
//                binding.twTV.setTextColor(getResources().getColor(R.color.C_B5B7BF));
//                binding.twV.setVisibility(View.INVISIBLE);
//                binding.vp.setCurrentItem(0, true);
//            }
//        });
//
//        binding.twLL.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                binding.tzTV.setTextColor(getResources().getColor(R.color.C_B5B7BF));
//                binding.tzV.setVisibility(View.INVISIBLE);
//                binding.twTV.setTextColor(getResources().getColor(R.color.C_32353B));
//                binding.twV.setVisibility(View.VISIBLE);
//                binding.vp.setCurrentItem(1, true);
//            }
//        });
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_target_record;
    }

    @Override
    protected Class getViewModelClass() {
        return AndroidViewModel.class;
    }
}
